package bean; 
      
    import java.text.SimpleDateFormat;  
import java.util.Date;  
      

    import javax.faces.application.FacesMessage;  
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;  
      

import org.primefaces.event.SelectEvent;  
    @ManagedBean
    @RequestScoped
    public class CalendarBean {  
      
        private Date date1;  
          
        public Date getDate1() {  
            return date1;  
        }  
      
        public void setDate1(Date date1) {  
            this.date1 = date1;  
        }  
      
        public void handleDateSelect(SelectEvent event) {  
            FacesContext facesContext = FacesContext.getCurrentInstance();  
            SimpleDateFormat format = new SimpleDateFormat("d/M/yyyy");  
            facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Data selezionata", format.format(event.getObject())));
        }  
        
        public Date getToday(){
        	return new Date();
        }
    }  
          